package com.ytjj.qmyx.supplychain.mapper;

import com.ytjj.qmyx.supplychain.common.model.OrderResponse;
import com.ytjj.qmyx.supplychain.common.model.request.*;
import com.ytjj.qmyx.supplychain.common.model.response.BankerOrderResponse;
import com.ytjj.qmyx.supplychain.common.model.response.NewBankerOrderResponse;
import com.ytjj.qmyx.supplychain.common.model.response.ProductRankingResponse;
import com.ytjj.qmyx.supplychain.common.model.response.TodayStatisticsResponse;
import com.ytjj.qmyx.supplychain.mapper.entity.YxBankerOrder;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface BankerOrderMapper extends Mapper<YxBankerOrder> {
    /**
     * 查询看板顶部统计
     * @param countRequest
     * @return
     */
    TodayStatisticsResponse selectTodayCount(@Param("countRequest") BankerOrderCountRequest countRequest);

    /**
     * 查询
     * @param countRequest
     * @return
     */
    List<ProductRankingResponse> selectProductRanking(@Param("countRequest") BankerOrderCountRequest countRequest);

    /**
     * 查询待发货
     * @param bankerId
     * @return
     */
    Integer selectWaitShipProduct(@Param("bankerId") Integer bankerId);

    /**
     * @Description 获取栏目名称
     *
     * 
     * 
     * @Version 1.0
     **/
//    String getColumnName(String orderNo);

    String getTypeno(Integer id);

    String getTypenoNew(Integer id);

    String getTypenoNewByChildOrderNo(String childOrderNo);

//    String getBankerColumnId(Integer id);

    String getBankerName(@Param("bankerId") Integer bankerId);

    int checkOrdersExpressInfo(@Param("orderNoList") List<String> orderNoList);

    List<YxBankerOrder> queryOrders(ExportOrdersRequest exportOrdersRequest);

    List<YxBankerOrder> getBankerOrders(OrderRequest request);

    List<BankerOrderResponse> getBankerOrderList(PlatformExportRequest request);

    boolean updateBankerOrders(@Param("list") List<OrdersExpressRequest> list);

    int updateBankerOrdersBySingle(BankerOrderExpressRequest request);

    List<NewBankerOrderResponse> findBankerOrderInfoByNo(@Param("orderNo") String orderNo);

    List<NewBankerOrderResponse> findSupplyOrderInfoById(@Param("orderId") Integer orderId);

    List<NewBankerOrderResponse> findBankerOrderInfoByChildOrderNo(@Param("childOrderNo") String childOrderNo);

    boolean confirmDelivery(NewBankerOrderResponse newBankerOrderResponse);

    /**
     * 6天内（不包括最近1一天）的异常的订单
     */
    List<YxBankerOrder> queryBankerOrderListBy6Day();

    /**
     * 30天内（不包括最近6一天）的异常的订单
     */
    List<YxBankerOrder> queryBankerOrderListBy30Day();

    /**
     * 超30天未发货的订单
     */
    List<YxBankerOrder> queryBankerOrderListGt30Day();

    void updateIsExportByChildOrderNoList(@Param("list") List<String> childOrderNoList);

    Integer updateOrderInfoStatus(String childOrderNo, Integer status);

    List<OrderResponse> queryOrdersResponse(ExportOrdersRequest exportOrdersRequest);

    List<YxBankerOrder> selectByChildOrderNoList(@Param("childOrderNos") List<String> childOrderNos);

    List<YxBankerOrder> selectByChildOrderNo(@Param("childOrderNos") List<String> childOrderNos);

    int  updateOrderReturnGoodStatus(@Param("childOrderNos") List<String> childOrderNos);

    int  updateOrderExportTime(@Param("id") Integer id);

    List<YxBankerOrder> selectByExpressNos(@Param("expressNoList") List<String> expressNoList);

    /**
     * 更新订单为已发货状态
     * @param orderInfoId 订单id
     * @param mark 0-更新为未完成 1-更新为已发货
     * @return int
     */
    int updateOrderInfoFinishState(Integer orderInfoId,Integer mark);

    /**
     * 根据物流更新订单信息
     */
    int updateByExpress(YxBankerOrder yxBankerOrder);

    /**
     * 根据快递单号查询订单
     * @param expressNo
     * @param expressCode
     */
    List<YxBankerOrder> getBankerOrdersByExpressNo(String expressNo,String expressCode);

    YxBankerOrder findByChildOrderNo(String childOrderNo);

    void updateBankerOrderAddress(String childOrderNo, String tel, String address,String newTel,String userName);

    void updateOrderAddress(String childOrderNo, String tel, String address,String newTel,String userName);


}
